package com.tanquandan.askbackend.controller;

import com.tanquandan.askbackend.dto.KeywordDto;
import com.tanquandan.askbackend.dto.R;
import com.tanquandan.askbackend.entity.Keyword;
import com.tanquandan.askbackend.service.IKeywordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/keyword")
public class KeywordController {
    @Autowired
    private IKeywordService keywordService;

    @GetMapping("/listAll")
    public R<List<KeywordDto>> list(){
        return keywordService.listKeywordCourseList();
    }

    @PostMapping
    public R<String> save(@RequestBody Keyword keyword){
        keywordService.save(keyword);
        return R.success("添加成功");
    }
}
